home *** CD-ROM | disk | FTP | other *** search
- Path: engnews1.Eng.Sun.COM!taumet!clamage
- From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
- Newsgroups: comp.std.c++
- Subject: Re: Are all Windows programs ill-formed?
- Date: 31 Jan 1996 15:50:47 GMT
- Organization: SEL
- Sender: news@lts.sel.alcatel.de
- Approved: clamage@eng.sun.com (comp.std.c++)
- Message-ID: <KANZE.96Jan31161809@slsvewt.lts.sel.alcatel.de>
- References: <AE5J83na99@qsar.chem.msu.su>
- NNTP-Posting-Host: taumet.eng.sun.com
- Content-Type: text
- In-Reply-To: "Eugene Radchenko"'s message of 29 Jan 1996 10:52:19 PST
- Apparently-To: std-c++@ncar.ucar.edu
- Content-Length: 2085
- X-Lines: 37
- Originator: clamage@taumet
-
- In article <AE5J83na99@qsar.chem.msu.su> "Eugene Radchenko"
- <eugene@qsar.chem.msu.su> writes:
-
- |> I have just realized that something is grossly overlooked in C++ standard.
- |> It requires every program to have the main() function (which implementation
- |> is not allowed to supply) with parameters (void) or (int argc, int*argv[]).
- |> However, Windows programs have another convention: prrogram must contain
- |> the function
- |> int WinMain(HINSTANCE curInst, HINSTANCE prevInst, LPSTR cmdline, int cmdShow)
- |> Some of this is of course quirks or even outright ignored in Win32
- |> (prevInst), but the full non-parsed command line could be useful sometimes,
- |> and not all implementations provide the function retrieving it. And anyway
- |> this is definitely not a main() from the specs. Maybe the requirements on
- |> the main() should be relaxed somehow?
-
- Implementations are not prevented from having extensions, nor from
- requiring non-standard means of getting at those extensions. A
- program without a main (at least in a hosted environment) is
- undefined; if the implementation wishes to give it a specific
- definition, it is free to do so.
-
- What the standard guarantees is what is portable. If an
- implementation wishes to support the above, it can, but it *must*
- support the two variants of main described in the standard; if you
- want your code to be even slightly portable, then you must provide one
- of these variants. Of course, portability can be compromised by other
- things as well. For example, if you are running under Windows, it is
- probable that you also use a number of special library functions that
- won't be available on other machines, either. So it may not
- particularly worry you that the absense of a main means that your
- program is using a platform specific extension.
- --
- James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
- GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
- Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
- -- A la recherche d'une activitΘ dans une region francophone
-
-
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
- is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
-
-